<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function getMax (arr) {
            var max = -Infinity;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] > max) {
                    max = arr[i];
                }
            }
            return max;
        }
        var arr1 = [22, 30, 56, 57, 5879, 21];
        var arr2 = [22, 6, 56, 56, 559, 21];
        var arr3 = [56, 30, 56, 57, 49, 21];
        var arr4 = [22, 30, 56, 57, 59, 21];
        console.log(getMax(arr1));
        console.log(getMax(arr2));
        console.log(getMax(arr3));
        console.log(getMax(arr4));
    </script>
</body>
</html>